﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace gerenxinxi
{
    public partial class info : Form
    {
        public info()
        {
            InitializeComponent();
        }
        //Base ba = new Base();
        public int a = 0;
        public string id;
       
        private void changeInfo_Click(object sender, EventArgs e)
        {
            
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            //OpenFileDialog op = new OpenFileDialog();
            //op.ShowDialog();
            ////string path1 = System.IO.Path.GetDirectoryName(op.FileName) + @"\";
            //string path1 = System.IO.Path.GetFullPath(op.FileName);
            //string path2 = Application.StartupPath;//运行路径
            ////MessageBox.Show(path2);
            ////MessageBox.Show(op.FileName);//完整路径
            //ba.oUpdate("update userInfo set p_photo='" + path1 + "' where p_name='" + id + "'");
            //pictureBox1.ImageLocation = @path1;
        }
        private void 个人信息_Load(object sender, EventArgs e)
        {
            //ba.oledataset.Clear();
            //if (1 == ba.oSelectDs("select * from userInfo where id='" + id + "'", "userInfo"))
            //{
            //    textBox5.Text = ba.oledataset.Tables["userInfo"].Rows[0][2].ToString().Trim();//用户名
            //    textBox6.Text = ba.oledataset.Tables["userInfo"].Rows[0][3].ToString().Trim();
            //    textBox4.Text = ba.oledataset.Tables["userInfo"].Rows[0][4].ToString().Trim();
            //    //MessageBox.Show(ba.ds.Tables["userInfo"].Rows[0][2].ToString().Trim());
            //    //pictureBox1.ImageLocation = ba.ds.Tables["userInfo"].Rows[0][5].ToString().Trim();
            //}
            //else
            //{
            //    MessageBox.Show("导入数据出错", "提示");
            //}
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            this.Close();
            a=1;
        }

        private void 个人信息_FormClosed(object sender, FormClosedEventArgs e)
        {
            a = 1;
        }

        private void toolStripLabel1_Click(object sender, EventArgs e)
        {

        }
        //修改信息
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            if (textBox5.Text == null)
            {
                MessageBox.Show("请输入姓名", "提示");
            }
            else if (textBox6.Text == null)
            {
                textBox6.Text = "无";
            }
            else if (textBox4.Text == null)
            {
                textBox4.Text = "无";
            }
            else
            {
                if (string.Compare(toolStripButton2.Text, "修改个人信息") == 0)
                {
                    //toolStripButton2.Text = "修改完成";
                    //textBox5.Enabled = true;
                    //textBox6.Enabled = true;
                    //textBox4.Enabled = true;
                    //pictureBox1.Enabled = true;
                }
                else
                {
                    //toolStripButton2.Text = "修改个人信息";
                    //ba.oUpdate("update userInfo set p_name='" + textBox5.Text.Trim().Replace("\"", " ").Replace("\'", " ") +
                    //    "',p_motto='" + textBox4.Text.Trim()
                    //    + "',p_favour='" + textBox6.Text.Trim()
                    //    + "' where id='" + id + "'");
                    //textBox5.Enabled = false;
                    //textBox6.Enabled = false;
                    //textBox4.Enabled = false;
                    //pictureBox1.Enabled = false;
                }
            }
        }
    }
}
